const mysql = require('mysql2')

const config = require('./config')

const connection = mysql.createPool({
  host: config.DATABASE_HOST,
  password: config.DATABASE_PASSWORD,
  user: config.DATABASE_USER,
  port: config.DATABASE_PORT,
  database:config.DATABASE_NAME
})

connection.getConnection((err, conn) => {
  if (err) {
    return
  }
  console.log('database is connecting');
})
module.exports = connection.promise()